﻿<!--
 Peter
 Created by: Peter Development Team
    http://peter.codeplex.com/
 
 GNU General Public License version 2 (GPLv2)
    http://peter.codeplex.com/license
-->
<UserControl x:Class="Peter.View.ViewNewProject"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:controls="clr-namespace:Peter.Common.Controls;assembly=Peter.Common"
             xmlns:icons="clr-namespace:Peter.Common.Icons;assembly=Peter.Common"
             xmlns:dialogs="clr-namespace:Peter.Logic.Dialogs"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="700"
             d:DataContext="{d:DesignInstance Type=dialogs:ModelNewProject}">
   <Grid>
      <Grid.Resources>
         <CollectionViewSource x:Key="_Projects"
                               Source="{Binding Path=ProjectManager.ProjectTypes}">
            <CollectionViewSource.GroupDescriptions>
               <PropertyGroupDescription PropertyName="ProjectGroup" />
            </CollectionViewSource.GroupDescriptions>
         </CollectionViewSource>
      </Grid.Resources>
      
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="*" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      
      <Grid.ColumnDefinitions>
         <ColumnDefinition Width="325" />
         <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>

      <TextBlock Grid.Row="0"
                 FontWeight="Bold"
                 FontSize="22"
                 FontFamily="Trebuchet MS"
                 VerticalAlignment="Center"
                 Text="New Project" />

      <ListBox ItemsSource="{Binding Source={StaticResource _Projects}}"
               SelectedItem="{Binding Path=SelectedItem}"
               Grid.Row="1" Grid.Column="0">
         <!--<ListBox.GroupStyle>
            <GroupStyle>
               <GroupStyle.ContainerStyle>
                  <Style TargetType="{x:Type GroupItem}">
                     <Setter Property="Template">
                        <Setter.Value>
                           <ControlTemplate>
                              <Expander Header="{Binding Name}"
                                        IsExpanded="True">
                                 <ItemsPresenter Margin="10,0,0,0" />
                              </Expander>
                           </ControlTemplate>
                        </Setter.Value>
                     </Setter>
                  </Style>
               </GroupStyle.ContainerStyle>
            </GroupStyle>
         </ListBox.GroupStyle>-->

         <ListBox.ItemTemplate>
            <DataTemplate>
               <StackPanel Orientation="Horizontal">
                  <icons:IconDisplay Icon="{Binding Path=Icon}" />
                  <TextBlock Text="{Binding Path=Name}"
                             Margin="4,0,0,0" />
               </StackPanel>
            </DataTemplate>
         </ListBox.ItemTemplate>
      </ListBox>

      <Grid Grid.Row="2"
            Grid.Column="0">

         <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
         </Grid.RowDefinitions>

         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
         </Grid.ColumnDefinitions>

         <TextBlock Grid.Row="0"
                    Grid.Column="0"
                    Text="Name:"
                    VerticalAlignment="Center" />

         <TextBlock Grid.Row="1"
                    Grid.Column="0"
                    Text="Location:"
                    VerticalAlignment="Center" />
         
         <TextBox Grid.Row="0"
                  Grid.Column="1"
                  Margin="4,0"
                  Text="{Binding Path=NewProjectName, UpdateSourceTrigger=PropertyChanged}" />

         <TextBox Grid.Row="1"
                  Grid.Column="1"
                  Margin="4,0"
                  Text="{Binding Path=NewProjectLocation, UpdateSourceTrigger=PropertyChanged}" />
         
         <Button Grid.Row="1"
                 Grid.Column="2"
                 Content="Browse..."
                 Command="{Binding Path=BrowseCommand}"/>
      </Grid>

      <Grid Grid.Row="0"
            Grid.RowSpan="3"
            Grid.Column="1"
            Margin="10,0,0,0">
         
         <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
         </Grid.RowDefinitions>

         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
         </Grid.ColumnDefinitions>

         <TextBlock Grid.Row="0"
                    FontWeight="Bold"
                    FontFamily="Trebuchet MS"
                    VerticalAlignment="Center"
                    Text="New Project Location:" />
         
         <Button Grid.Row="0"
                 Grid.Column="1"
                 ToolTip="Hide Browse"
                 Command="{Binding Path=HideBrowseCommand}">
            <icons:IconDisplay IconSize="Smallest"
                               Icon="ChevronLeft" />
         </Button>

         <controls:Explorer Grid.Row="1"
                            Grid.Column="0"
                            Grid.ColumnSpan="2"
                            ShowFiles="False"
                            SelectedTreeItem="{Binding Path=SelectedLocation, Mode=TwoWay}" />

      </Grid>
   </Grid>
</UserControl>
